import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

// import 'package:toutiao/tt/index/IndexTab.dart';
// import 'package:toutiao/tt/infolist/SearchTxt.dart';

class InkWellTab extends StatefulWidget {
  String text;
  Function function;

  InkWellTab(this.text, this.function);

  @override
  createState() => new InkWellTabState(text, function);
}

class InkWellTabState extends State<InkWellTab> {
  Border border;
  String text;
  Function function;

  InkWellTabState(this.text, this.function);

  @override
  void dispose() {
    super.dispose();
  }

  @override
  void initState() {
    super.initState();
  }

  void doTap(String type) {
    setState(() {
      print(type);
      border = Border(
          bottom: BorderSide(
        color: const Color(0xFF000000),
        width: 10.0,
        style: BorderStyle.solid,
      ));
      function.call();
    });
  }

  @override
  Widget build(BuildContext context) {
    return new InkWell(
        child: Expanded(
          child: new Container(
            width: 50,
            height: 80,
            alignment: Alignment.center,
            child: new Text(
              text,
              textAlign: TextAlign.center,
              style: new TextStyle(
                  color: Colors.white,
                  fontSize: 16,
                  fontWeight: FontWeight.bold),
            ),
          ),
        ),
        highlightColor: Colors.grey,
        customBorder: border,
        onTap: () => doTap(text));
  }
}
